# privacy_compliance_checker.py
import numpy as np

class PrivacyComplianceChecker:
    """Validates differential privacy guarantees using Gaussian mechanism"""
    
    @staticmethod
    def calculate_epsilon(sigma, delta=1e-5):
        """
        Calculate (ε, δ)-DP guarantee for Gaussian mechanism
        
        Args:
            sigma (float): Noise standard deviation
            delta (float): Privacy failure probability (default=1e-5)
            
        Returns:
            float: ε privacy budget
        """
        return np.sqrt(2 * np.log(1.25 / delta)) / sigma
    
    @staticmethod
    def check_violation(epsilon, threshold=0.35):
        """
        Check if privacy budget exceeds threshold
        
        Args:
            epsilon (float): Current privacy budget
            threshold (float): Privacy threshold (default=0.35)
            
        Returns:
            bool: True if violation detected, False otherwise
        """
        return epsilon > threshold
